﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using WebCrawlerTools.page;

namespace WebCrawlerTools.data
{
    [Serializable]
    public class DataCenter
    {
        public static DataCenter Load()
        {
            DataCenter dataCenter = new DataCenter();
            dataCenter.BasicInfo = DBasicInfo.Load();
            return dataCenter;
        }

        public static void Store(DataCenter dataCenter)
        {
            DBasicInfo.Store(dataCenter.BasicInfo);
         }

        public static void ToCSV(ArrayList data,String csvFileName)
        {
            using (System.IO.StreamWriter writer = new System.IO.StreamWriter(csvFileName,true,Encoding.Default))
            {
                foreach(SLine row in data)
                {
                    writer.WriteLine(row.ToString());
                }
            }
        }

        public ArrayList PHomePages
        {
            get { return BasicInfo.PHomePages; }
            set { BasicInfo.PHomePages = value; }
        }

         public DBasicInfo BasicInfo
        {
            get
            {
                return basicinfo;
            }
            set
            {
                basicinfo = value;
            }
        }

        public DDataInfo DataInfo
        {
            get
            {
                return datainfo;
            }
            set
            {
                datainfo = value;
            }
        }

        private DBasicInfo basicinfo;
        private DDataInfo datainfo = new DDataInfo();
    }
}
